//actions里发送Ajax请求 所以需要引入axios二次封装函数
import {req_login} from '@/utils/registerLogin.js';
export default {
    async login_info({commit},{user_name,password,routerT}){
        console.log({user_name,password,routerT});//login传递过来的参数
        let result = await req_login({
            method:'post',
            url:'/login',
            params:{user_name,password},
            headerType:'form'
        });
        console.log(result);
        if(result.info == '登录成功！！'){
            routerT.push({name:'home'})
        }
        commit('login',{
            user_name,
            info:result.info,
            token:result.token
        })
    }
}